import java.util.ArrayList;

import struct.Function;
import struct.Identity;
import struct.Rule;
import struct.Term;
import struct.Variable;

public class Repository {
	public static ArrayList<Rule> generateRules()
    {
        ArrayList<Rule> result = new ArrayList<Rule>();
        Term l1, l2, r1, r2;
        Function f1, f2, f3, f4, f5, i;
        
        Identity []aux = {new Variable("x", 0), new Variable("y", 0)};
        f1 = new Function("f", aux);
        
        aux = new Identity[2];
        aux[0] = new Variable("y", 0);
        aux[1] = new Variable("z", 0);
        f2 = new Function("f", aux);
        
        aux = new Identity[2];
        aux[0] = f1;
        aux[1] = new Variable("z", 0);
        f3 = new Function("f", aux);
        
        aux = new Identity[2];
        aux[0] = new Variable("x", 0);
        aux[1] = f2;
        f4 = new Function("f", aux);
        
        aux = new Identity[1];
        aux[0] = new Variable("x", 1);
        i = new Function("i", aux);
        
        aux = new Identity[2];
        aux[0] = i;
        aux[1] = new Variable("x", 1);
        f5 = new Function("f", aux);
          
        l1 = new Term(f3);
        l2= new Term(f5);
        r1 = new Term(f4);
        r2 = new Term(new Variable("e", 0));
        result.add(new Rule(l1, r1));
        result.add(new Rule(l2, r2));
        
        System.out.println("TRS: ");
        System.out.println(result.get(0));
        System.out.println(result.get(1));
        
        return result;
    }
	
	public static ArrayList<Rule> generateRules2()
    {
        ArrayList<Rule> result = new ArrayList<Rule>();
        Term l1, l2, r1, r2;
        Function f1, g1, f2, f3, g2;
        
        Identity []aux = { new Variable("x", 0) };
        f2 = new Function("f", aux);
        
        aux = new Identity[1];
        aux[0] = f2;
        g1 = new Function("g", aux);
        
        aux = new Identity[1];
        aux[0] = g1;
        f1 = new Function("f", aux);

        aux = new Identity[1];
        aux[0] = new Variable("x", 0);
        g2 = new Function("g", aux);
        
        aux = new Identity[1];
        aux[0] = g2;
        f3 = new Function("f", aux);
          
        l1 = new Term(f1);
        l2 = new Term(f3);
        r1 = new Term(new Variable("x", 0));
        r2 = new Term(g1);
        result.add(new Rule(l1, r1));
        result.add(new Rule(l2, r2));
        
        System.out.println("TRS: ");
        System.out.println(result.get(0));
        System.out.println(result.get(1));
        
        return result;
    }

	
	public static ArrayList<Rule> generateRules3()
    {
        ArrayList<Rule> result = new ArrayList<Rule>();
        Function f, ff, g;
        Identity[] aux = {new Variable("x", 0)};
        f = new Function("f", aux);
        
        aux = new Identity[1];
        aux[0] = f;
        ff = new Function("f", aux);
        
        aux = new Identity[1];
        aux[0] = new Variable("x", 0);
        g = new Function("g", aux);
        
        result.add(new Rule(new Term(ff), new Term(g)));
        System.out.println("TRS: ");
        System.out.println(result.get(0));
        
        return result;
    }
}
